﻿using Koala.Pro.CodeGenerator.UI.Common.Adapter.SqlsugarWPF;
using Koala.Pro.CodeGenerator.UI.Controls;
using Koala.Pro.CodeGenerator.UI.DatabaseModel.Schema;

namespace Koala.Pro.CodeGenerator.UI.Common.EntityProject
{
    public class SqlSugarWpfProject
    {
        public static void Execute(DatabaseInfo databaseInfo, List<string> selectedTableNames, List<string> searchFields, List<string> searchDisplay, List<string> editFields, List<string> editCheck, string duplicateCheckField, IProgressCallback progress)
        {
            var templateFile = "SqlSugar/Templates/WPF/ViewModels/ListViewModel.cs.vm";
            var adapter = new ViewModelAdapter(databaseInfo, selectedTableNames, searchFields, searchDisplay, editFields, editCheck, "", templateFile);
            adapter.Execute();

            templateFile = "SqlSugar/Templates/WPF/ViewModels/EditViewModel.cs.vm";
            adapter = new ViewModelAdapter(databaseInfo, selectedTableNames, searchFields, searchDisplay, editFields, editCheck, "", templateFile);
            adapter.Execute();

            templateFile = "SqlSugar/Templates/WPF/Pages/ListPage.xaml.cs.vm";
            var searchFormAdapter = new SearchFormAdapter(databaseInfo, selectedTableNames, searchFields, searchDisplay, editFields, editCheck, "", templateFile);
            adapter.Execute();

            templateFile = "SqlSugar/Templates/WPF/Pages/ListPage.xaml.vm";
            searchFormAdapter = new SearchFormAdapter(databaseInfo, selectedTableNames, searchFields, searchDisplay, editFields, editCheck, "", templateFile);
            adapter.Execute();

            templateFile = "SqlSugar/Templates/WPF/Pages/EditPage.xaml.cs.vm";
            var editFormAdapter = new EditFormAdapter(databaseInfo, selectedTableNames, searchFields, searchDisplay, editFields, editCheck, "", templateFile);
            adapter.Execute();

            templateFile = "SqlSugar/Templates/WPF/Pages/EditPage.xaml.vm";
            editFormAdapter = new EditFormAdapter(databaseInfo, selectedTableNames, searchFields, searchDisplay, editFields, editCheck, "", templateFile);
            adapter.Execute();
        }
    }
}
